package evenements;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import modele.entites.TypeBot;
import vues.IHM;
import vues.ProfilWindow;

public class EcouteurProfilFrame implements ActionListener {

	private ProfilWindow frm;
	private IHM ihm;
	private int x, y;
	
	public EcouteurProfilFrame(ProfilWindow frm, IHM ihm, int x, int y) {
		super();
		this.frm = frm;
		this.ihm = ihm;
		this.x = x;
		this.y = y;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		switch (e.getActionCommand()) {
		case "Valider":
			this.ihm.getHorloge().getSimulateur().addRobot(this.frm.getTypeRobot(),this.frm.getRobotName(), x, y);
			this.frm.dispose();
			this.ihm.refresh();
			break;
		case "Annuler":
				this.frm.dispose();
			break;
		}
	}

}
